<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title>电影票选坐</title>
		<style type="text/css">
			ul{
				width: 400px;
				height: 500px;
				border: #BEBEBE 2px solid;
				margin: 0 auto;
				
			}
			li{
				height: 90px;
				width: 90px;
				background-color: #BEBEBE;
				border: #BEBEBE 2px solid;
				margin-left: 2px;
				margin-top: 5px;
				float: left;
				list-style: none;
			}
			#div{
				width: 200px;
				height: 100px;
				border: #BEBEBE 2px solid;
				text-align: center;
				margin: 0 auto;
				margin-top: 400px;
			}
			#nav .clink{
				background-color: #FF0000;
			}
			.clink{
				background-color: #A0522D;
			}
		</style>
	</head>
	<body>
		<ul>
			<li></li>
			<li></li>
			<li></li>
			<li></li>
			<li></li>
			<li></li>
			<li></li>
			<li></li>
			<li></li>
			<li></li>
			<li></li>
			<li></li>
			<li></li>
			<li></li>
			<li></li>
			<li></li>
			<div id="div">
				<h2>屏幕中央</h2>
			</div>
		</ul>
		
		<script type="text/javascript">
		window.onload = function(){
			var li = document.getElementsByTagName('li');
			for(var i = 0 ; i < li.length ; i++){
				li[i].onclick = function(event){
					var r = this.getAttribute('class');
					if(!r){
						this.setAttribute('class','clink');
						var x = event.clientX;
						var y = event.clientY;
						this.innerHTML = '座位已选--'+'座位号为:'+'('+x+','+y+')';
					} else {
						this.setAttribute('class','');
						this.innerHTML = '';
						alert('你已经成功取消');
					}
				}
			}
			
		}
			
		</script>
	</body>
</html>
